package com.bjpowernode.boss.web.model.response;

import com.bjpowernode.boss.enums.RespCode;
import lombok.Data;
//返回给前端的
@Data
public class CommonResult {
    private Integer code;
    private String msg;
    private Object data;

    public static CommonResult succ(Object data){
        CommonResult Result = new CommonResult();
        Result.setCode(RespCode.OK.getNumber());
        Result.setMsg(RespCode.OK.getMsg());
        Result.setData(data);
        return Result;
    }

    public static CommonResult fail(RespCode respCode){
        CommonResult Result = new CommonResult();
        Result.setCode(respCode.getNumber());
        Result.setMsg(respCode.getMsg());
        Result.setData("");
        return Result;
    }
}
